package com.ctgu.蓝桥杯真题.B组2018;

import java.io.*;

/**
 * @author: Backdiy
 * @data: 2021/4/13 12:40
 * @desc:
 */
public class G螺旋折线 {
    public static void main(String[] args) throws IOException {
        long n = IO.nextInt();
        long m = IO.nextInt();
        long max = Math.max(Math.abs(n), Math.abs(m));
        long min = Math.min(Math.abs(n), Math.abs(m));
        long dis = 0;
        if (n >= 0) {
            if (m >= 0) {
                dis = 4 * max * max;
                if (n < m) {
                    dis = dis - (max - n);
                } else if (n > m) {
                    dis = dis + (max - m);
                }
            } else if (m <= 0) {
                dis = 4 * max * max + 2 * max;
                m = -m;
                if (n < m) {
                    dis = dis + (max - n);
                } else if (n > m) {
                    dis = dis - (max - m);
                }
            }
        } else if (n <= 0) {
            if (m >= 0) {
                long t = max;
                max = 2 * max - 1;
                dis = max * max + max;
                n = -n;
                if (n > m) {
                    dis = dis - (t - m);
                } else if (n < m) {
                    dis = dis + (t - n);
                }
            } else if (m <= 0) {
                long t = max;
                n = -n;
                m = -m;
                max = 2 * max - 1;
                dis = max * max;
                if (n < m) {
                    dis = dis - (t - n);
                } else if (n > m) {
                    dis = dis + (t - m);
                }
            }
        }
        IO.out.println(dis);
        IO.out.flush();
    }

    static class IO {
        static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        static BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
        static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));

        static public int nextInt() throws IOException {
            in.nextToken();
            return (int) in.nval;
        }

        static public String readLine() throws IOException {
            return read.readLine();
        }
    }
}
